package com.atguigu.day01;

/**
 * 面试题
 *
 * @author sx
 * @date 2022-02-24 16:12
 */
public class Demo9 {
    public static void main(String[] args) {
        StringBuffer sb = new StringBuffer("Hello");
        System.out.println("Before: "+sb.toString());
        System.out.println(sb.hashCode());
        changeStr(sb);
        System.out.println(sb.hashCode());
        System.out.println("After : "+sb.toString());
    }

    private static void changeStr(StringBuffer sb) {
        System.out.println(sb.hashCode());
        sb = new StringBuffer("world");
        System.out.println(sb.hashCode());
    }
}
